#include <iostream>
#include <ctime>
#include "consultant.h"

using namespace std;

timespec diff(timespec start, timespec end);

int main(int argc, char *argv[])
{

	Consultant ca;

	timespec start, end, result;

	/* Parte A */

	clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start);
	ca.getInput();
	ca.solveA();
	clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end);

	result = diff(start, end);

	cout << result.tv_sec * (unsigned long) 1000000000 + result.tv_nsec << " ";

	/* Parte B */

	clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start);
	ca.solveB();
	clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end);

	result = diff(start, end);

	cout << result.tv_sec * (unsigned long) 1000000000 + result.tv_nsec << endl;
	
	// cout << ca;

	return 0;
}

timespec diff(timespec start, timespec end)
{
	timespec temp;
	if((end.tv_nsec - start.tv_nsec) < 0)
	{
		temp.tv_sec = end.tv_sec - start.tv_sec - 1;
		temp.tv_nsec = 1000000000 + end.tv_nsec - start.tv_nsec;
	}
	else
	{
		temp.tv_sec = end.tv_sec - start.tv_sec;
		temp.tv_nsec = end.tv_nsec - start.tv_nsec;
	}
	return temp;
}